// EMModeConfig.h 
// EMWiFiControl 
// 
// Created by HCC on 2018/12/7. 
//  
//

#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>


NS_ASSUME_NONNULL_BEGIN

@class EMCommand;
@class CBPeripheral;
@interface EMModeConfig : NSObject

////// ============ AP ============ //////
/**
 >> @brief  设备AP名称  */
@property(nonatomic, copy  ) NSString *apSSID;
/**
 >> @brief  设备AP密码  */
@property(nonatomic, copy  ) NSString *apPwd;
/**
 >> @brief  设备host  */
@property(nonatomic, copy  ) NSString *apHost;
/**
 >> @brief  设备端口  */
@property(nonatomic, assign) NSUInteger apPort;


////// ============ BLE ============ //////
/**
 >> @brief  设备蓝牙名称,如果设置了这个属性就认为是蓝牙配对  */
@property(nonatomic, copy  ) NSString *bleSSID;
/**
 >> @brief  设备蓝牙检索地址  */
@property(nonatomic, strong) NSArray *bleRetrieveUUIDs;
/**
 >> @brief  设备蓝牙服务地址  */
@property(nonatomic, strong) NSString *bleServiceUUID;
/**
 >> @brief  设备蓝牙写地址  */
@property(nonatomic, copy  ) NSString *bleWriteUUID;
/**
 >> @brief  设备蓝牙读地址  */
@property(nonatomic, copy  ) NSString *bleReadUUID;
/**
 >> @brief  设备蓝牙对象  */
@property(nonatomic, strong) CBPeripheral *peripheral;


////// ============ WiFi ============ //////
/**
 >> @brief  wifi名称  */
@property(nonatomic, copy  ) NSString *wifiSSID;
/**
 >> @brief  wifi密码*/
@property(nonatomic, copy  ) NSString *wifiPwd;
/**
 >> @brief  服务器host  */
@property(nonatomic, copy  ) NSString *serviceHost;
/**
 >> @brief  服务器端口  */
@property(nonatomic, assign) NSUInteger servicePort;


/**
 >> @brief  设置连接器类名  */
@property (nonatomic, copy  ) NSString *connecterClassName;

/**
 >> @brief  是否能自动连接AP 或 WiFi, 默认YES  */
@property(nonatomic, assign) BOOL canAutoConnect;

/**
 >> @brief  初始化时的指令列表(执行过程中额外增加的指令通过didAddNewCommand获取)  */
@property(nonatomic, strong) NSArray<EMCommand *> *listCommand;

/**
 >> @brief  默认为listCommand的个数,如果执行过程中有额外增加的指令,需要重设  */
@property(nonatomic, assign) NSUInteger totalCommandCount;

/**
 >> @brief  配对结果  */
@property(nonatomic, copy  ) NSString * resultContent;

/**
 *  配置对象新加了1条指令时的回调
 *
 */
@property (nonatomic, copy) void (^didAddNewCommand)(EMCommand *cmd);


/**
 *  绑定设备请求业务(异步)
 *
 */
@property (nonatomic, copy) BOOL (^bindRequestHandle)(NSString *resultContent);


/**
 *  配对结果的回调
 *
 */
@property (nonatomic, copy) void (^pairSuccess)(NSString *resultContent);


/**
 *  @brief  传递给Conneter之前调用此方法初始化指令列表
 */
- (void)setupCommands;


/**
 *  配置对象收到了1条信息,这个接口内决定需不需要增加额外的业务
 *
 *  @param  message  消息内容
 *  @return BOOL 是否接收到了期望的信息
 */
- (BOOL)command:(EMCommand *)cmd didReceiveMessage:(NSString *)message;


/**
 *  绑定结果回调(没有实现绑定设备请求业务时,默认拿到mac地址即绑定成功)
 *
 */
- (void)bindingDeviceResult:(void(^)(NSString *resultContent))ret;


@end

NS_ASSUME_NONNULL_END
